#*****************************************************************
#  name         : java
#  remark       : java 8
#  tag          : 8
#  level        : service
#  author       : mason
#  build shell  : docker build -t 10.100.135.125:5000/java:8 .
#  run shell    : docker run -d -P --name java.8.0 10.100.135.125:5000/java:8 .
#  push shell   : docker push 10.100.135.125:5000/java:8
#  pull shell   : docker pull 10.100.135.125:5000/java:8
#*****************************************************************

FROM 10.100.135.125:5000/centos:7.0

MAINTAINER "mason" <masl@mail.open.com.cn>

LABEL company="OPEN"

RUN yum install -y wget unzip

ENV SOURCE_PATH=$PATH

RUN mkdir /data/server/java && \
    echo "SOURCE_PATH=$PATH" >> /etc/profile && \
    wget -P /data/server/java http://f.open.com.cn/S/shell/java/jdk-8u73-linux-x64.tar.gz  && \
    tar -zxvf /data/server/java/jdk-8u73-linux-x64.gz -C /data/server/java/  && \
    rm -f /data/server/java/jdk-8u73-linux-x64.gz  && \
    rm -fr /data/server/java/jdk1.8.0_73/*.zip
    ln -s /data/server/java/jdk1.8.0_73 /data/server/java/default && \
    echo "JAVA_8_HOME=/usr/java/default" >> /etc/profile && \
    alias jdk8='export JAVA_HOME=$JAVA_8_HOME' && \
    echo "alias jdk6='export JAVA_HOME=$JAVA_6_HOME;export CLASSPATH=$JAVA_6_HOME/lib/dt.jar:$JAVA_8_HOME/lib/tools.jar;export PATH=$SOURCE_PATH:$JAVA_8_HOME/bin'" >> /etc/profile && \
    echo "CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar" >> /etc/profile && \
    echo "PATH=$SOURCE_PATH:$JAVA_HOME/bin" >> /etc/profile && \
    echo "JAVA_HOME=$JAVA_8_HOME" >> /etc/profile

ENV JAVA_8_HOME=/usr/java/default
ENV JAVA_HOME=$JAVA_8_HOME
ENV CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV PATH=$SOURCE_PATH:$JAVA_HOME/bin

RUN source /etc/profile && \
    java -version

ENTRYPOINT  /bin/bash
